﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Jzy.BLL.SiteAdmin;
using Jzy.Core.Utility;

namespace Jzy.Web.SiteAdmin.Article
{
    public partial class Move : PageSelectTree
    {
        private MenuBO _menu = new MenuBO();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                BindTree();
            }
            tvList.Attributes.Add("onclick", "SingleSelect()");
        }

        private void BindTree()
        {
            _menu.BindTreeView(tvList, true, null);
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strArticleIDs = Request["ArticleIDs"];
            List<int> articleIDs = StrUtil.SplitToInt(strArticleIDs);

            List<int> menuIDs = StrUtil.SplitToInt(CheckedIDs);
            if (menuIDs.Count > 0)
            {
                ArticleBO article = new ArticleBO();
                article.MoveMenu(articleIDs, menuIDs.First());
            }
            JSUtil.ResponseJS("close();returnValue=true");
        }  
    }
}
